﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web;
using System.Web.Routing;

namespace SRF.UI
{
    /// <summary>
    /// 菜单节点过滤器
    /// </summary>
    public class SiteMapNodeVisibilityProvider : MvcSiteMapProvider.FilteredSiteMapNodeVisibilityProvider
    {
        public override bool IsVisible(MvcSiteMapProvider.ISiteMapNode node, IDictionary<string, object> sourceMetadata)
        {
            bool visible = base.IsVisible(node, sourceMetadata);
            if (visible)
            {
                visible = SRF.Security.SecurityContext.HasUrlGrant(node.Url);
            }

            return visible;
        }
    }
}